<template>
  <div class="diyVideoControl">
    <div class="control-section">
      <div class="control-header">
        <span>工具服务</span>
      </div>
      <div class="control-body">
        <div class="control-item">
          <div class="control-title flex-between">
            <span>主标题</span>
            <span class="reset" @click="resetItem('name')">重置</span>
          </div>
          <div class="control-content">
            <div class="keyword-input">
              <a-input placeholder="请输入搜索关键词" v-model="params.name" />
            </div>
          </div>
        </div>
        <fontControl
          :fontData.sync="params.css"
          :showAlign="false"
          @resetFontCss="resetFontCss"
        ></fontControl>
        <!-- 图片设置 -->
        <uploadImg
          :uploadImg="params.iconUrl"
          size="50*50px"
          @uploadSuccess="uploadSuccess"
          @deleteImg="deleteImg"
        ></uploadImg>
        <chooseLink
          style="margin-top: 12px"
          :link="params.link || {}"
          @chooseEnd="chooseLink"
        ></chooseLink>
      </div>
    </div>
  </div>
</template>


<script>
import fontControl from "@/components/DiyNew/diy/baseControl/fontControl/index.vue";
import uploadImg from "@/components/DiyNew/uploadImg/index.vue";
import chooseLink from "@/components/DiyNew/chooseLink/index.vue";
export default {
  name: "userToolControl",
  components: {
    fontControl,
    uploadImg,
    chooseLink,
  },
  props: {
    params: {
      type: Object,
      default: {},
    },
  },
  data() {
    return {};
  },
  methods: {
    uploadSuccess(e) {
      console.log(e);
      this.$setWithAction(this.params, "iconUrl", e.val);
      // this.params.params.picUrl = e.val
    },
    // 删除图片回调
    deleteImg(e) {
      this.$setWithAction(this.params, "iconUrl", "");
    },
    resetItem() {
      this.$setWithAction(this.params, "name", "默认");
    },
    resetFontCss() {
      let data ={
          color: "#000000",
          fontNum: "12",
          fontSize: "",
          fontStyle: "normal", // normal  italic斜体
          fontWeight: "normal", // normal bold加粗
          textDecoration: "inherit", // inherit underline下划线 line-through贯穿横线
        };
      this.$set(
        this.params,
        "css",
        data
      );
    },
    chooseLink(e) {
      this.$setWithAction(this.params, "link", e);
    },
  },
};
</script>


<style lang="scss" scoped>
.control-section {
  width: 100%;
  margin: 0 auto;
  text-align: center;
  .control-header {
    width: 100%;
    height: 48px;
    background: #ffffff;
    border-bottom: 1px solid #f0f2f5;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 24px;
    span:first-child {
      font-weight: 600;
      color: #000000;
    }
    span:last-child {
      font-size: 12px;
      color: #8c8c8c;
    }
  }
  .control-body {
    width: 228px;
    margin: 0 auto;
  }
}
.control-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 0 12px 0;
  font-size: 12px;
  font-weight: 400;
  color: #000000;
  .reset {
    font-size: 12px;
    font-weight: 400;
    color: #8e8e8e;
    cursor: pointer;
    user-select: none;
  }
  p {
    margin: 0;
  }
}
.control-item {
  width: 100%;
  .control-title {
    padding: 24px 0 14px 0;
    font-size: 12px;
    color: #000000;
    text-align: left;
  }
  .flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  .reset {
    font-size: 12px;
    color: #9e9e9e;
    cursor: pointer;
  }
  .control-content {
    .example-list {
      width: 100%;
      display: flex;
      flex-wrap: wrap;
      .example-item {
        width: 70px;
        height: 38px;
        background: #f6f7f9;
        border-radius: 4px;
        margin-right: 9px;
        display: flex;
        justify-content: center;
        align-items: center;
        cursor: pointer;
        img {
          width: 42px;
          height: 18px;
        }
      }
      .example-item:last-child {
        margin-right: 0;
      }
      .active {
        border: 2px solid #1890fc;
      }
    }
    .border-select,
    .fixed-top-select {
      width: 100%;
      height: 100%;
      ::v-deep .ant-select-selection--single {
        height: 100%;
        border: 0 none;
        background: #f2f2f2;
      }
      ::v-deep .ant-select-selection__rendered {
        line-height: 40px;
      }
    }
    .keyword-input {
      width: 228px;
      height: 40px;
      background: #f6f7f9;
      border-radius: 4px;
      input {
        height: 100%;
        background-color: #f6f7f9;
        border: 0 none;
      }
    }
  }
}
</style>